package main

import "fmt"

// 值类型：数组、基础数据类型和结构体
// 引用类型：切片、map

type Sdu struct {
	username string
	age      int
	sex      string
}

func (s Sdu) Print() {
	fmt.Printf("Print %v %v %v\n", s.sex, s.username, s.age)
}

func (s *Sdu) SetUsername(username string) {
	s.username = username
	s.Print()
}

func main() {
	fmt.Println("-----------------------------------------------")
	var s1 = Sdu{username: "陈好耳机", sex: "男"}
	s2 := s1
	s2.age = 300
	// 结构体是值类型
	fmt.Printf("%#v\n", s2)
	fmt.Printf("%#v\n", s1)
	s1.Print()
	fmt.Println("-----------------------------------------------")

	s1.SetUsername("ssy")
	s1.Print()
	fmt.Println("-----------------------------------------------")

}
